<%@page import="org.apache.struts.Globals"%>
<%@include file="header.jsp"%>      

  <%-- to avoid direct access by url, check logged --%>
  <logic:notPresent name="loginForm" scope="session">
    <jsp:forward page="/index.jsp"/>
  </logic:notPresent>
    
  <%-- if button cancel was clicked --%>
  <logic:messagesPresent property="operation">
    <% request.setAttribute( Globals.ERROR_KEY, null ); %>
    <jsp:forward page="/index.jsp"/>
  </logic:messagesPresent>
  
  <html:form action="/edituser">  
    <table>
      <tr>
        <td><bean:message key="label.Nome"/>:</td>
        <logic:messagesNotPresent>
        <td><input type="text" name="Nome" value="<bean:write name='loginForm' property='nome'/>"/></td>
        </logic:messagesNotPresent> 
        <logic:messagesPresent>
        <td><input type="text" name="Nome" value="<bean:write name='editUserForm' property='Nome'/>"/></td>
        </logic:messagesPresent> 
        <td><html:errors property="Nome"/></td>
      </tr>
      <tr>
        <td><bean:message key="label.Sobrenome"/>:</td>
        <logic:messagesNotPresent>
        <td><input type="text" name="Sobrenome" value="<bean:write name='loginForm' property='sobrenome'/>"/></td>
        </logic:messagesNotPresent>        
        <logic:messagesPresent>
        <td><input type="text" name="Sobrenome" value="<bean:write name='editUserForm' property='Sobrenome'/>"/></td>
        </logic:messagesPresent>
        <td><html:errors property="Sobrenome"/></td>
      </tr>
    </table>
    
    <html:submit property="operation"><bean:message key="button.save"/></html:submit>
    <html:submit property="operation"><bean:message key="button.cancel"/></html:submit>    
  </html:form>
    
<%@include file="footer.jsp"%>